package repertory.android.ericchen.androidrepertory.dao;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * className:UserBean
 * author: Ericchen
 * description:实体类
 * date: 2017/3/8 11:08
 * update: 2017/3/8
 * version:
 */
@DatabaseTable(tableName = "tb_user") //@DatabaseTable：标明这是数据库的一张表
public class UserBean {
    /**
     * DatabaseField表示这是表中的字段，generatedId自增
     * columnName: 为该字段在数据中的列名
     *
     */
    @DatabaseField(generatedId = true)
    private int id;
    @DatabaseField(columnName = "username")
    private String username;
    @DatabaseField(columnName = "count")
    private int count;
    /*ORMLite需要用到无参构造方法
    * 当ORMLite需要创建UserBean类时会使用到无参数的构造方法，
    * 并通过反射机制设置成员变量，也可以使用setter方法设置成员变量*/
    public UserBean() {
    }
    public UserBean(String username,int count){
        this.username = username;
        this.count = count;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}
